<?php
session_start();

# global variables and defines
require_once("common/globals.inc.php");

# common set of helper functions
require_once("common/common.inc.php");


# cache class
require_once("classes/cache.class.php");
$gCacheObject	=	new Classes_Cache();


# text class
require_once("classes/text.class.php");
$gText	=	new Classes_Text($gCacheObject);


# we can allow for session-based language
if	(!isset($_SESSION['language']))
{
	$_SESSION['language']	=	"en";
}
$language			=		$_SESSION['language'];

# create the language file
$fn					=		LANGUAGE_ARRAY_PATH		.	$language	.	".php";
# this will get the language array from the cache, or put it into the cache also
$gLanguageString	=	$gCacheObject->getOrSet(CACHE_TIME_TINY,"language","$language", "includeLanguageArray","$fn");

# xajax
require_once("xajax.inc.php");

# need this too
$objAjax->processRequest();




# redraw the page section (repopulate the text)
function doSetNewLanguageAndRedrawPage($language)
{
	global	$gText;

	# start new comment file
	resetCommentFile();

	$objResponse    =    new xajaxResponse();

	# get the text (from the cache if need be)
	$textString		=	$gText->getTextStringLanguage("LBL_DESCRIPTION",$language);

	$objResponse->assign("myInfo","innerHTML",$textString);


	displayLogsXajax($objResponse,'myCacheInfo');

	return	$objResponse;
}

# this version displays the logs but with a pre-prepared xajax object
function displayLogsXajax($objResponse,$id)
{
	# get the text (from the cache if need be)
	$textString		=	nl2br(loadFile(LOG_FILE));
	
	$objResponse->assign("$id","innerHTML",$textString);
}

# redraw the page section (repopulate the text)
function displayLogs($id)
{
	global	$gText;
	
	$objResponse    =    new xajaxResponse();

	# get the text (from the cache if need be)
	$text_string	=	nl2br(loadFile(LOG_FILE));
	
	$objResponse->assign("$id","innerHTML",$text_string);

	return	$objResponse;
}




?>